/*
 * Project Name spring-boot-tools
 * File Name Terminals
 * Package Name com.huxiaosu.tools.common.constant
 * Create Time 2024/7/15
 * Create by name：liujie
 */
package com.huxiaosu.tools.common.constant;

import lombok.Getter;

/**
 * 用于区分终端
 *
 * @author liujie
 * @date 2024/7/15 18:08
 */
@Getter
public enum Terminals {
    /**
     * android
     */
    ANDROID(1, "android"),
    /**
     * IOS
     */
    IOS(2, "ios"),
    /**
     * WEB
     */
    WEB(3, "web"),
    /**
     * PC
     */
    PC(4, "pc"),
    /**
     * DEFAULT
     */
    DEFAULT(0, "default"),
    ;
    private final int type;

    private final String name;
    Terminals(int type, String name) {
        this.type = type;
        this.name = name;
    }
    public static Terminals parse(int type) {
        for (Terminals operator : Terminals.values()) {
            if (operator.getType() == type) {
                return operator;
            }
        }
        return DEFAULT;
    }
}